﻿Namespace bitly

    Public Class bly_shorten_parameters

        Private _Long_URL As String = String.Empty
        Private _Domain As String = String.Empty
        'j.mp
        'or bit.ly
        Private _x_login As String = String.Empty
        Private _x_apiKey As String = String.Empty

        ''' <summary>
        ''' The URL-Encoded URL to be shortened
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the URL to be shortened.</returns>
        ''' <remarks></remarks>
        Public Property Long_URL() As String
            Get
                Return _Long_URL
            End Get
            Set(ByVal value As String)
                _Long_URL = value
            End Set
        End Property

        ''' <summary>
        ''' Refers to a preferred domain, either the defult bit.ly or j.mp
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the domain to shorten to.</returns>
        ''' <remarks></remarks>
        Public Property Domain() As String
            Get
                Return _Domain
            End Get
            Set(ByVal value As String)
                _Domain = value
            End Set
        End Property

        ''' <summary>
        ''' The pass along end-user login
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the pass along end-user login.</returns>
        ''' <remarks></remarks>
        Public Property x_login() As String
            Get
                Return _x_login
            End Get
            Set(ByVal value As String)
                _x_login = value
            End Set
        End Property

        ''' <summary>
        ''' The pass along end-user API key
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the pass along end-user API key.</returns>
        ''' <remarks></remarks>
        Public Property x_apiKey() As String
            Get
                Return _x_apiKey
            End Get
            Set(ByVal value As String)
                _x_apiKey = value
            End Set
        End Property

    End Class

    Public Class bly_shorten_results

        Private _URL As String = String.Empty
        Private _Hash As String = String.Empty
        Private _Global_Hash As String = String.Empty
        Private _Long_URL As String = String.Empty
        Private _New_Hash As String = String.Empty
        Public Status As New bly_error_status


        ''' <summary>
        ''' The actual link that should be used, and is a unique value for the given bit.ly account
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the shortened URL.</returns>
        ''' <remarks></remarks>
        Public Property URL() As String
            Get
                Return _URL
            End Get
            Set(ByVal value As String)
                _URL = value
            End Set
        End Property

        ''' <summary>
        ''' The bit.ly identifier for Long_URL, and is a unique value for the given bit.ly account
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the bit.ly identifier for Long_URL.</returns>
        ''' <remarks></remarks>
        Public Property Hash() As String
            Get
                Return _Hash
            End Get
            Set(ByVal value As String)
                _Hash = value
            End Set
        End Property

        ''' <summary>
        ''' The bit.ly identifier for Long_URL which can be used to track aggregate stats across all matching bit.ly links
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the bit.ly identifier for Long_URL.</returns>
        ''' <remarks></remarks>
        Public Property Global_Hash() As String
            Get
                Return _Global_Hash
            End Get
            Set(ByVal value As String)
                _Global_Hash = value
            End Set
        End Property

        ''' <summary>
        ''' The link initaly shortened, note this may not always be equal to the URL posted as some URL normalization may occur
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing the inital URL to be shortened.</returns>
        ''' <remarks></remarks>
        Public Property Long_URL() As String
            Get
                Return _Long_URL
            End Get
            Set(ByVal value As String)
                _Long_URL = value
            End Set
        End Property

        ''' <summary>
        ''' A fake Boolean, noteing if the Long_URL had been shortend by bit.ly before.
        '''  1 equals the first time the Long_URL was shortened
        '''  0 otherwise.
        ''' </summary>
        ''' <value></value>
        ''' <returns>An <c>String</c> representing if this is the first time the URL was shortened.</returns>
        ''' <remarks></remarks>
        Public Property New_Hash() As String
            Get
                Return _New_Hash
            End Get
            Set(ByVal value As String)
                _New_Hash = value
            End Set
        End Property


    End Class
End Namespace